# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ReplicaPool.V1beta1.Model.Action do
  @moduledoc """
  An action that gets executed during initialization of the replicas.

  ## Attributes

  *   `commands` (*type:* `list(String.t)`, *default:* `nil`) - A list of commands to run, one per line. If any command fails, the whole action is considered a failure and no further actions are run. This also marks the virtual machine or replica as a failure.
  *   `envVariables` (*type:* `list(GoogleApi.ReplicaPool.V1beta1.Model.EnvVariable.t)`, *default:* `nil`) - A list of environment variables to use for the commands in this action.
  *   `timeoutMilliSeconds` (*type:* `integer()`, *default:* `nil`) - If an action's commands on a particular replica do not finish in the specified timeoutMilliSeconds, the replica is considered to be in a FAILING state. No efforts are made to stop any processes that were spawned or created as the result of running the action's commands. The default is the max allowed value, 1 hour (i.e. 3600000 milliseconds).
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :commands => list(String.t()),
          :envVariables => list(GoogleApi.ReplicaPool.V1beta1.Model.EnvVariable.t()),
          :timeoutMilliSeconds => integer()
        }

  field(:commands, type: :list)
  field(:envVariables, as: GoogleApi.ReplicaPool.V1beta1.Model.EnvVariable, type: :list)
  field(:timeoutMilliSeconds)
end

defimpl Poison.Decoder, for: GoogleApi.ReplicaPool.V1beta1.Model.Action do
  def decode(value, options) do
    GoogleApi.ReplicaPool.V1beta1.Model.Action.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.ReplicaPool.V1beta1.Model.Action do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
